package com.schoolinfo.model;
// default package

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * Goods entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="goods"
)

public class Goods  implements java.io.Serializable {


    // Fields    

     private Integer id;
     private SecondClass secondClass;
     private User user;
     private String name;
     private String type;
     private String state;
     private String pic;
     private String contactName;
     private Timestamp publishTime;
     private String place;
     private Integer hot;
     private String describe;
     private Set<Report> reports = new HashSet<Report>(0);
     
     private float price;
     private float oldPrice;


    // Constructors
   

	/** default constructor */
    public Goods() {
    }

	/** minimal constructor */
    public Goods(String name) {
        this.name = name;
    }
    
    /** full constructor */
    public Goods(SecondClass secondClass, User user, String name, String type, String state, String pic, String contactName, Timestamp publishTime, String place, Integer hot, String describe, Set<Report> reports,float price,float oldPrice) {
        this.secondClass = secondClass;
        this.user = user;
        this.name = name;
        this.type = type;
        this.state = state;
        this.pic = pic;
        this.contactName = contactName;
        this.publishTime = publishTime;
        this.place = place;
        this.hot = hot;
        this.describe = describe;
        this.reports = reports;
        this.price=price;
        this.oldPrice=oldPrice;
    }

    /** full constructor，no secondClass */
    public Goods(User user, String name, String type, String state, String pic, String contactName, Timestamp publishTime, String place, Integer hot, String describe, Set<Report> reports,float price,float oldPrice) {
       
        this.user = user;
        this.name = name;
        this.type = type;
        this.state = state;
        this.pic = pic;
        this.contactName = contactName;
        this.publishTime = publishTime;
        this.place = place;
        this.hot = hot;
        this.describe = describe;
        this.reports = reports;
        this.price=price;
        this.oldPrice=oldPrice;
    }
   
    // Property accessors
    @Id @GeneratedValue
    
    @Column(name="[id]", unique=true, nullable=false)

    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="secondClassId")

    public SecondClass getSecondClass() {
        return this.secondClass;
    }
    
    public void setSecondClass(SecondClass secondClass) {
        this.secondClass = secondClass;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="userId")

    public User getUser() {
        return this.user;
    }
    
    public void setUser(User user) {
        this.user = user;
    }
    
    @Column(name="name", nullable=false, length=50)

    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name="[type]", length=10)

    public String getType() {
        return this.type;
    }
    
    public void setType(String type) {
        this.type = type;
    }
    
    @Column(name="[state]", length=10)

    public String getState() {
        return this.state;
    }
    
    public void setState(String state) {
        this.state = state;
    }
    
    @Column(name="[pic]")

    public String getPic() {
        return this.pic;
    }
    
    public void setPic(String pic) {
        this.pic = pic;
    }
    
    @Column(name="contactName", length=50)

    public String getContactName() {
        return this.contactName;
    }
    
    public void setContactName(String contactName) {
        this.contactName = contactName;
    }
    
    @Column(name="publishTime", length=19)

    public Timestamp getPublishTime() {
        return this.publishTime;
    }
    
    public void setPublishTime(Timestamp publishTime) {
        this.publishTime = publishTime;
    }
    
    @Column(name="place")

    public String getPlace() {
        return this.place;
    }
    
    public void setPlace(String place) {
        this.place = place;
    }
    
    @Column(name="hot")

    public Integer getHot() {
        return this.hot;
    }
    
    public void setHot(Integer hot) {
        this.hot = hot;
    }
    
    @Column(name="[describe]", length=65535)

    public String getDescribe() {
        return this.describe;
    }
    
    public void setDescribe(String describe) {
        this.describe = describe;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="goods")

    public Set<Report> getReports() {
        return this.reports;
    }
    
    public void setReports(Set<Report> reports) {
        this.reports = reports;
    }
   
    @Column(name="price")
    public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	@Column(name="oldPrice")
	public float getOldPrice() {
		return oldPrice;
	}

	public void setOldPrice(float oldPrice) {
		this.oldPrice = oldPrice;
	}







}